﻿
<template>
<div class="card-fill layout-padding">
<el-card shadow="hover" class="layout-padding-auto" >
  <el-form ref="formRefEnergyConsumptionRecord" :model="stateEnergyConsumptionRecord.vmModel" label-width="100px">
    <el-row>
      
    <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_UploadTime_FormItem" prop="Entity.UploadTime" label="上传时间">
            <el-date-picker v-model="stateEnergyConsumptionRecord.vmModel.Entity.UploadTime" disabled clearable></el-date-picker>
        </el-form-item>
    </el-col>
    <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_stationCode_FormItem" prop="Entity.stationCode" label="工位号">
            <el-input v-model="stateEnergyConsumptionRecord.vmModel.Entity.stationCode" disabled clearable></el-input>
        </el-form-item>
    </el-col>
    <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_machineCode_FormItem" prop="Entity.machineCode" label="设备编号">
            <el-input v-model="stateEnergyConsumptionRecord.vmModel.Entity.machineCode" disabled clearable></el-input>
        </el-form-item>
    </el-col>
    <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_Airpressure_FormItem" prop="Entity.Airpressure" label="压力">
            <el-input v-model="stateEnergyConsumptionRecord.vmModel.Entity.Airpressure" disabled clearable></el-input>
        </el-form-item>
    </el-col>
    <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_Flow_FormItem" prop="Entity.Flow" label="累计流量">
            <el-input v-model="stateEnergyConsumptionRecord.vmModel.Entity.Flow" disabled clearable></el-input>
        </el-form-item>
    </el-col>
    <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_Energy_FormItem" prop="Entity.Energy" label="累计电能">
            <el-input v-model="stateEnergyConsumptionRecord.vmModel.Entity.Energy" disabled clearable></el-input>
        </el-form-item>
    </el-col>
    <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_VoltageA_FormItem" prop="Entity.VoltageA" label="A相电压">
            <el-input v-model="stateEnergyConsumptionRecord.vmModel.Entity.VoltageA" disabled clearable></el-input>
        </el-form-item>
    </el-col>
    <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_VoltageB_FormItem" prop="Entity.VoltageB" label="B相电压">
            <el-input v-model="stateEnergyConsumptionRecord.vmModel.Entity.VoltageB" disabled clearable></el-input>
        </el-form-item>
    </el-col>
    <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_VoltageC_FormItem" prop="Entity.VoltageC" label="C相电压">
            <el-input v-model="stateEnergyConsumptionRecord.vmModel.Entity.VoltageC" disabled clearable></el-input>
        </el-form-item>
    </el-col>
    <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_ElectricityA_FormItem" prop="Entity.ElectricityA" label="A相电流">
            <el-input v-model="stateEnergyConsumptionRecord.vmModel.Entity.ElectricityA" disabled clearable></el-input>
        </el-form-item>
    </el-col>
    <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_ElectricityB_FormItem" prop="Entity.ElectricityB" label="B相电流">
            <el-input v-model="stateEnergyConsumptionRecord.vmModel.Entity.ElectricityB" disabled clearable></el-input>
        </el-form-item>
    </el-col>
    <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_ElectricityC_FormItem" prop="Entity.ElectricityC" label="C相电流">
            <el-input v-model="stateEnergyConsumptionRecord.vmModel.Entity.ElectricityC" disabled clearable></el-input>
        </el-form-item>
    </el-col>
    <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_Time_FormItem" prop="Entity.Time" label="采集时间">
            <el-input v-model="stateEnergyConsumptionRecord.vmModel.Entity.Time" disabled clearable></el-input>
        </el-form-item>
    </el-col>
    <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_Unit_FormItem" prop="Entity.Unit" label="单位">
            <el-input v-model="stateEnergyConsumptionRecord.vmModel.Entity.Unit" disabled clearable></el-input>
        </el-form-item>
    </el-col>
    <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_acquisitionInterval_FormItem" prop="Entity.acquisitionInterval" label="采集时间间隔">
            <el-input v-model="stateEnergyConsumptionRecord.vmModel.Entity.acquisitionInterval" disabled clearable></el-input>
        </el-form-item>
    </el-col>
    <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_machineStatus_FormItem" prop="Entity.machineStatus" label="设备状态">
            <el-input v-model="stateEnergyConsumptionRecord.vmModel.Entity.machineStatus" disabled clearable></el-input>
        </el-form-item>
    </el-col>
    <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_uploadflag_FormItem" prop="Entity.uploadflag" label="上传标识" :rules="[{ required: true, message:'上传标识为必填项',trigger:'blur'}]">
            <el-select v-model="stateEnergyConsumptionRecord.vmModel.Entity.uploadflag" disabled clearable>
                <el-option :key="1" :value=true :label="$t('message._system.common.vm.tips_bool_true')"></el-option>
                <el-option :key="0" :value=false :label="$t('message._system.common.vm.tips_bool_false')"></el-option>
                </el-select>
        </el-form-item>
    </el-col>
    </el-row>

    <div style="text-align:right;">
      <WtmButton @click="onCloseEnergyConsumptionRecord"  type="primary" :button-text="$t('message._system.common.vm.cancel')" style="margin-top:15px;"/>
    </div>
  </el-form>

</el-card>
</div>
</template>


<script setup lang="ts" name="message._system.common.vm.detail;false">
import {  ElMessageBox, ElMessage } from 'element-plus';
import { defineAsyncComponent,reactive, ref, getCurrentInstance, onMounted, nextTick } from 'vue';
import { EnergyConsumptionRecordApi } from '/@/api/record/EnergyConsumptionRecord';
import other from '/@/utils/other';
import fileApi from '/@/api/file';
import { useRouter } from "vue-router";
const ci = getCurrentInstance() as any;

// 定义变量内容
const formRefEnergyConsumptionRecord = ref();
const stateEnergyConsumptionRecord = reactive({
      vmModel: {
	  Entity:{
      			ID: null,
			UploadTime: null,
			stationCode: null,
			machineCode: null,
			Airpressure: null,
			Flow: null,
			Energy: null,
			VoltageA: null,
			VoltageB: null,
			VoltageC: null,
			ElectricityA: null,
			ElectricityB: null,
			ElectricityC: null,
			Time: null,
			Unit: null,
			acquisitionInterval: null,
			machineStatus: null,
			uploadflag: null,

      },
      
	},
    
     
});

// 取消
const onCloseEnergyConsumptionRecord = () => {
    closeDialog();
};


// 页面加载时
onMounted(() => {
    
     if (ci.attrs["wtmdata"]) {
		stateEnergyConsumptionRecord.vmModel.Entity.ID = ci.attrs["wtmdata"].ID;
	}
	else if (useRouter().currentRoute.value.query.id) {
		stateEnergyConsumptionRecord.vmModel.Entity.ID = useRouter().currentRoute.value.query.id as any;
	}
	EnergyConsumptionRecordApi().get(stateEnergyConsumptionRecord.vmModel.Entity.ID ?? "").then((data: any) => other.setValue(stateEnergyConsumptionRecord.vmModel, data));
});

// 定义子组件向父组件传值/事件
const emit = defineEmits(['refresh','closeDialog']);
// 关闭弹窗
const closeDialog = () => {
    emit('closeDialog');
};
// 暴露变量
defineExpose({

});
</script>

<style scoped lang="scss">

</style>

